package com.xuecheng.manage_cms;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.domain.EntityScan;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.data.mongodb.repository.config.EnableMongoRepositories;
import org.springframework.http.client.OkHttp3ClientHttpRequestFactory;
import org.springframework.web.client.RestTemplate;

/**
 * @Author Andrew Yang
 * @ClassName ManageCmsApplication
 * @Description 启动类
 * @Package com.xuecheng
 * @create 2019-12-25 10:57
 */
@SpringBootApplication
//扫描实体类
@EntityScan("com.xuecheng.framework.domain.cms")
/**
 * 扫描接口
 * 扫描本项目下的所有类
 * 扫描common工程下的类
 */
@ComponentScan(basePackages = {"com.xuecheng.api","com.xuecheng.manage_cms","com.xuecheng.framework"})
@EnableMongoRepositories
public class ManageCmsApplication {
    public static void main(String[] args) {
        SpringApplication.run(ManageCmsApplication.class, args);
    }

    @Bean
    public RestTemplate restTemplate() {
        return new RestTemplate(new OkHttp3ClientHttpRequestFactory());
    }
}
